Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example Phoenix application #1948

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

magnetised
Copy link
Contributor

@magnetised magnetised commented Nov 6, 2024

Plus update the gatekeeper-auth example to use the new Electric.Phoenix apis

Copy link
Contributor

@robacourt robacourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@thruflo
Copy link
Contributor

thruflo commented Nov 6, 2024

Awesome! Can you add a note/section to the Phoenix docs linking to and flagging up this example?

@magnetised magnetised force-pushed the magnetised/add-phoenix-example branch from ce1e6c3 to 182ec74 Compare November 7, 2024 09:27
@magnetised
Copy link
Contributor Author

Awesome! Can you add a note/section to the Phoenix docs linking to and flagging up this example?

ada8941

@thruflo how's that?

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 2159108
🔍 Latest deploy log https://app.netlify.com/sites/electric-next/deploys/673cb67245b1290008d4bfa2
😎 Deploy Preview https://deploy-preview-1948--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@magnetised magnetised force-pushed the magnetised/add-phoenix-example branch from ada8941 to 17c1d83 Compare November 7, 2024 10:51
@thruflo
Copy link
Contributor

thruflo commented Nov 7, 2024

@magnetised nice, ta. Two niggly suggestions:

  1. rename the example folder to electric-phoenix, the -example prefix just adds noise and we're removing them
  2. move this down to the page, above the help wanted section

So make it a:

## Examples

### electric-phoenix

...

<HelpWanted ...

So we can add multiple examples over time. Ideally with some description of what the example shows (i.e.: the scope of the integration / functionality).

As per https://electric-sql.com/docs/integrations/next#examples (but actually up a heading level).

### electric-phoenix

See the
[elixir-phoenix example](https://github.com/electric-sql/electric/tree/main/examples/electric-phoenix)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo on the package name.

If the example is a LiveView example, perhaps we should rename it examples/phoenix-liveview? And then the description there and here, rather than "using Electric for cross-browser synchronisation" can be e.g.:

This is an example Phoenix LiveView application that uses
[`Electric.Phoenix.live_stream/4`](https://hexdocs.pm/electric_phoenix/Electric.Phoenix.html#live_stream/4)
to sync data from Postgres into a LiveView using
[Phoenix Streams](https://fly.io/phoenix-files/phoenix-dev-blog-streams/).
This keeps the LiveView automatically in-sync with Postgres, without having
to re-run queries or trigger any change handling yourself.

See the
[documentation](https://electric-sql.com/docs/integrations/phoenix#liveview-sync)
for more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -80,13 +80,22 @@ For more details and full documentation see [hexdocs.pm/electric_phoenix](https:

## Examples

### electric-phoenix
### phoenix-liveview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks :)

Just one more tiny thing (sorry!) is this heading can now be "Phoenix LiveView".

Copy link
Contributor

@@ -80,6 +80,25 @@ This makes your LiveView applications real-time. In fact, it allows you to build

For more details and full documentation see [hexdocs.pm/electric_phoenix](https://hexdocs.pm/electric_phoenix).

## Examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one thought here is it's probably worth also mentioning the Gatekeeper auth example here, as an example using the Plug, e.g.:

### Phoenix LiveView

... as is ...

### Gatekeeper Auth

The [gatekeeper-auth](https://github.com/electric-sql/electric/tree/main/examples/gatekeeper-auth) example also contains a Phoenix application that uses [Electric.Phoenix.Plug](#...) to authorize shape access and issue shape-scoped access tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants